/* eslint-disable class-methods-use-this */
import {
  get,
  post,
  put,
  _delete,
} from '@/lin/plugins/axios'

// 我们通过 class 这样的语法糖使模型这个概念更加具象化，其优点：耦合性低、可维护性。
class Teacher {
  async getTeacherList(page, limit, info) {
    const res = await get(`v1/teacher?page=${page}&limit=${limit}`, info)
    return res
  }

  async getTeacherInfo(id) {
    const res = await get(`v1/teacher/${id}`)
    return res
  }

  async createTeacher(info) {
    const res = await post('v1/teacher', info)
    return res
  }

  async updateTeacher(info) {
    const res = await put('v1/teacher', info)
    return res
  }

  async deleteTeacher(id) {
    const res = await _delete(`v1/teacher/${id}`)
    return res
  }
}

export default new Teacher()
